var t = getApp();

Page({
    data: {
        gxz_name: "",
        contribution_today: "",
        countAmount: "",
        page: 1
    },
    onLoad: function(t) {
        this.getindex();
    },
    onReady: function() {},
    onShow: function() {
        this.getData();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var t = this.data.page + 1;
            this.setData({
                page: t
            }), this.getMore();
        }
    },
    onShareAppMessage: function() {},
    tapUrl: function(t) {
        console.log(t), "pastLog" == t.currentTarget.dataset.url ? wx.navigateTo({
            url: "/packageI/newGroup/pastLog/pastLog"
        }) : wx.navigateTo({
            url: "/packageI/newGroup/groupcblog/groupcblog"
        });
    },
    getData: function() {
        var a = this, n = t.getNetAddresss("plugin.zhp-group-lottery.frontend.contribution.get-reward-list");
        t._postNetWork({
            url: n,
            success: function(t) {
                var n = t.data;
                1 == n.result ? a.setData({
                    info: n.data.data,
                    current_page: n.data.current_page,
                    last_page: n.data.last_page
                }) : wx.showToast({
                    title: n.msg,
                    duration: 1e3,
                    icon: "none"
                });
            }
        });
    },
    getMore: function() {
        var a = this, n = this, o = t.getNetAddresss("plugin.zhp-group-lottery.frontend.contribution.get-reward-list");
        t._postNetWork({
            url: o,
            data: {
                page: n.data.page
            },
            success: function(t) {
                var o = t.data;
                1 == o.result ? a.setData({
                    info: n.data.info.concat(o.data.data),
                    current_page: o.data.current_page,
                    last_page: o.data.last_page
                }) : wx.showToast({
                    title: o.msg,
                    duration: 1e3,
                    icon: "none"
                });
            }
        });
    },
    getindex: function() {
        var a = this, n = t.getNetAddresss("plugin.zhp-group-lottery.frontend.contribution.index");
        t._postNetWork({
            url: n,
            success: function(t) {
                var n = t.data;
                1 == n.result ? (a.setData({
                    gxz_name: n.data.gxz_name,
                    contribution_today: n.data.contribution_today,
                    countAmount: n.data.countAmount
                }), wx.setNavigationBarTitle({
                    title: "珍惠拼"
                })) : wx.showToast({
                    title: n.msg,
                    duration: 1e3,
                    icon: "none"
                });
            }
        });
    }
});